<?php

/**
 * This is the model class for table "klinikposkb".
 *
 * The followings are the available columns in table 'klinikposkb':
 * @property integer $kpkb_id
 * @property integer $kpkb_kec
 * @property integer $kpkb_klin_dinkes
 * @property integer $kpkb_klin_abri
 * @property integer $kpkb_klin_lain
 * @property integer $kpkb_klin_swasta
 * @property integer $kpkb_jumlah
 * @property integer $kpkb_poskb
 * @property integer $kpkb_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $kpkbKec
 */
class Klinikposkb extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Klinikposkb the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'klinikposkb';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('kpkb_kec, kpkb_klin_dinkes, kpkb_klin_abri, kpkb_klin_lain, kpkb_klin_swasta, kpkb_jumlah, kpkb_poskb, kpkb_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('kpkb_id, kpkb_kec, kpkb_klin_dinkes, kpkb_klin_abri, kpkb_klin_lain, kpkb_klin_swasta, kpkb_jumlah, kpkb_poskb, kpkb_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'kpkbKec' => array(self::BELONGS_TO, 'Kecamatan', 'kpkb_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'kpkb_id' => 'Kpkb',
			'kpkb_kec' => 'Kpkb Kec',
			'kpkb_klin_dinkes' => 'Kpkb Klin Dinkes',
			'kpkb_klin_abri' => 'Kpkb Klin Abri',
			'kpkb_klin_lain' => 'Kpkb Klin Lain',
			'kpkb_klin_swasta' => 'Kpkb Klin Swasta',
			'kpkb_jumlah' => 'Kpkb Jumlah',
			'kpkb_poskb' => 'Kpkb Poskb',
			'kpkb_tahun' => 'Kpkb Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('kpkb_id',$this->kpkb_id);
		$criteria->compare('kpkb_kec',$this->kpkb_kec);
		$criteria->compare('kpkb_klin_dinkes',$this->kpkb_klin_dinkes);
		$criteria->compare('kpkb_klin_abri',$this->kpkb_klin_abri);
		$criteria->compare('kpkb_klin_lain',$this->kpkb_klin_lain);
		$criteria->compare('kpkb_klin_swasta',$this->kpkb_klin_swasta);
		$criteria->compare('kpkb_jumlah',$this->kpkb_jumlah);
		$criteria->compare('kpkb_poskb',$this->kpkb_poskb);
		$criteria->compare('kpkb_tahun',$this->kpkb_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}